Component({
  properties: {
    remark: {
      type: String,
      value: ''
    }
  },
  data: {
    showPopup: false
  },
  methods: {
    togglePopup() {
      this.setData({
        showPopup: !this.data.showPopup
      })

      if (this.data.showPopup) {
        // 点击外部区域关闭气泡
        setTimeout(() => {
          wx.onTouchStart(this.hidePopup)
        }, 100)
      } else {
        wx.offTouchStart(this.hidePopup)
      }
    },

    // 隐藏气泡
    hidePopup() {
      this.setData({
        showPopup: false
      })
      wx.offTouchStart(this.hidePopup)
    }
  }
})